#!/bin/bash

work_shell=/var/csv/script/clean_expired_file_arm.sh
sleep_time=86400

clean_expired_file()
{
    while true
    do               
        bash $work_shell
    sleep $sleep_time
    done
}

main()
{
    scriptname=`basename $0` 
    
    ps -ef|grep -v grep|grep -q "${scriptname}"
    if [ "$?" = "0" ];
    then    
        echo "$scriptname is running now, can't run it again."  
        exit 0 
    else  
        clean_expired_file
    fi  
}

main

